﻿Imports System
Imports System.Collections
Imports System.Collections.Specialized
Imports System.Drawing

Namespace System.Workflow.ComponentModel.Design
    Public NotInheritable Class DesignerAction
        ' Methods
        Public Sub New(ByVal activityDesigner As ActivityDesigner, ByVal actionId As Integer, ByVal [text] As String)
            If (activityDesigner Is Nothing) Then
                Throw New ArgumentNullException("activityDesigner")
            End If
            If (([text] Is Nothing) OrElse ([text].Length = 0)) Then
                Throw New ArgumentException(SR.GetString("Error_NullOrEmptyValue"), "text")
            End If
            Me.activityDesigner = activityDesigner
            Me.actionId = actionId
            Me.text = [text]
        End Sub

        Public Sub New(ByVal activityDesigner As ActivityDesigner, ByVal actionId As Integer, ByVal [text] As String, ByVal image As Image)
            Me.New(activityDesigner, actionId, [text])
            Me.image = image
        End Sub

        Public Sub Invoke()
            Me.activityDesigner.OnExecuteDesignerAction(Me)
        End Sub


        ' Properties
        Public ReadOnly Property ActionId As Integer
            Get
                Return Me.actionId
            End Get
        End Property

        Public ReadOnly Property Image As Image
            Get
                Return Me.image
            End Get
        End Property

        Public Property PropertyName As String
            Get
                Return Me.propertyName
            End Get
            Set(ByVal value As String)
                Me.propertyName = value
            End Set
        End Property

        Public ReadOnly Property [Text] As String
            Get
                Return Me.text
            End Get
        End Property

        Public ReadOnly Property UserData As IDictionary
            Get
                If (Me.userData Is Nothing) Then
                    Me.userData = New HybridDictionary
                End If
                Return Me.userData
            End Get
        End Property


        ' Fields
        Private actionId As Integer
        Private activityDesigner As ActivityDesigner
        Private image As Image
        Private propertyName As String
        Private [text] As String
        Private userData As IDictionary
    End Class
End Namespace

